home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr05 / xnot12a.zip / XNOTALRM.C < prev    next >
C/C++ Source or Header  |  1993-06-03  |  939b  |  45 lines

  1.   
  2. #include "jam.h"
  3.  
  4.  
  5. main(ac, av)
  6. int ac;
  7. char **av;
  8. {
  9.   Display *dpy = XOpenDisplay(getenv("DISPLAY"));
  10.  
  11.   if (ac != 2)
  12.     {
  13.       printf("Bad args to xnotalrm\n");
  14.       exit (-1);
  15.     }
  16.  
  17.   if (dpy)
  18.     {
  19.       int s_screen = DefaultScreen(dpy);
  20.       unsigned long x_mask = KeyPressMask | KeyReleaseMask;
  21.       Window window = XCreateSimpleWindow(dpy, RootWindow(dpy, s_screen), 
  22.                    10, 50, 10 * strlen(av[1]), 10, 0,
  23.                  BlackPixel(dpy, s_screen), 
  24.                  WhitePixel(dpy, s_screen));
  25.       XSelectInput(dpy, window, x_mask);
  26.       XStoreName(dpy, window, av[1]);
  27.       XMapWindow(dpy, window);
  28.       XSync(dpy, 1);
  29.       XBell(dpy, 0);
  30.       XBell(dpy, 0);
  31.       while (1)
  32.         {
  33.           XEvent event;
  34.          
  35.           XNextEvent(dpy, &event);
  36.           if (event.type == ButtonPress || event.type == KeyPress)
  37.             exit(0);
  38.         }
  39.    }
  40.   else
  41.     {
  42.       printf("Can't open display\n");
  43.       exit (-1);
  44.     }
  45. }